-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: update hash script data #351
fix: update hash script data #351
Conversation
Is there a source on the change? Is this the case for old scripts? |
I guess this is related to the change in redeemer structure from always being a flat array to also being a map, does the node assume if it's empty it uses the map structure then? The cddl seems to allow it being an array still (at least until the next era after conway). What happens if in the tx you use the empty legacy flat map structure?
|
Currently, I encounter a |
@hadelive I can't seem to access that channel. My point was does this mismatch always happen? Does it matter if your datums/redeemers are encoded differently in the tx? You can have an empty list be either one of those (empty list or empty map), or are they just missing entirely? Our API for the script data hash calc requires a list for redeemers (unlike datums). In the previous cbor spec for the data hash it used to say how to handle this exactly when there were none, as the old comments said. Is there anywhere we can refer to for the new behavior? Does this apply to spending old (v1/v2) scripts? |
here's one example {
"body": {
"inputs": [
{
"transaction_id": "8e3d9138777c56c6e3fc1ce9083b13f91f5ce45da8ad7e80d4215b524af2bf8a",
"index": 1
}
],
"outputs": [
{
"AlonzoFormatTxOut": {
"address": "addr_test1qz0ugv82ruadcg8whwqnkfjfapwfxn49hsfa0dlmu2eyu5zsvjm8zc6dzn9c64p7w8wcadph53l0k3askg5g9pnvggxsvy935c",
"amount": {
"coin": 1327480,
"multiasset": {
"ef6ed47a6917a3cbbeb46561e8853da969343794d66128598a34af2c": {
"4275726e61626c65546f6b656e32": 1
}
}
},
"datum_hash": "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec"
}
},
{
"AlonzoFormatTxOut": {
"address": "addr_test1qz0ugv82ruadcg8whwqnkfjfapwfxn49hsfa0dlmu2eyu5zsvjm8zc6dzn9c64p7w8wcadph53l0k3askg5g9pnvggxsvy935c",
"amount": {
"coin": 6193203350,
"multiasset": {
"22691d3d969ecf5802226290c2fb98e2bc08522d5b726c1f5f400105": {
"54657374": 21
},
"cac67dd80f706e084b2aac605288b2ff793475ea43b2313e1ed384ab": {
"54657374": 13,
"4275726e61626c65546f6b656e506c75747573": 1,
"accbfb633f637e3bb1abee40c9539d1effd742cd2716b3b1db9de3aaf3f37794": 1
},
"ef6ed47a6917a3cbbeb46561e8853da969343794d66128598a34af2c": {
"4275726e61626c65546f6b656e32": 3
}
}
},
"datum_hash": null
}
}
],
"fee": 202461,
"ttl": null,
"certs": null,
"withdrawals": null,
"auxiliary_data_hash": null,
"validity_interval_start": null,
"mint": {
"ef6ed47a6917a3cbbeb46561e8853da969343794d66128598a34af2c": {
"4275726e61626c65546f6b656e32": 3
}
},
"script_data_hash": "2f50ea2546f8ce020ca45bfcf2abeb02ff18af2283466f888ae489184b3d2d39",
"collateral_inputs": [
{
"transaction_id": "8e3d9138777c56c6e3fc1ce9083b13f91f5ce45da8ad7e80d4215b524af2bf8a",
"index": 1
}
],
"required_signers": null,
"network_id": null,
"collateral_return": {
"AlonzoFormatTxOut": {
"address": "addr_test1qz0ugv82ruadcg8whwqnkfjfapwfxn49hsfa0dlmu2eyu5zsvjm8zc6dzn9c64p7w8wcadph53l0k3askg5g9pnvggxsvy935c",
"amount": {
"coin": 6189733291,
"multiasset": {
"22691d3d969ecf5802226290c2fb98e2bc08522d5b726c1f5f400105": {
"54657374": 21
},
"cac67dd80f706e084b2aac605288b2ff793475ea43b2313e1ed384ab": {
"54657374": 13,
"4275726e61626c65546f6b656e506c75747573": 1,
"accbfb633f637e3bb1abee40c9539d1effd742cd2716b3b1db9de3aaf3f37794": 1
},
"ef6ed47a6917a3cbbeb46561e8853da969343794d66128598a34af2c": {
"4275726e61626c65546f6b656e32": 1
}
}
},
"datum_hash": null
}
},
"total_collateral": 5000000,
"reference_inputs": null,
"voting_procedures": null,
"proposal_procedures": null,
"current_treasury_value": null,
"donation": null
},
"witness_set": {
"vkeywitnesses": null,
"native_scripts": [
{
"ScriptAll": {
"native_scripts": [
{
"ScriptPubkey": {
"ed25519_key_hash": "9fc430ea1f3adc20eebb813b2649e85c934ea5bc13d7b7fbe2b24e50"
}
}
]
}
}
],
"bootstrap_witnesses": null,
"plutus_v1_scripts": null,
"plutus_datums": [
{
"constructor": 0,
"fields": []
}
],
"redeemers": null,
"plutus_v2_scripts": null,
"plutus_v3_scripts": null
},
"is_valid": true,
"auxiliary_data": null
} cbor
The error we get when paying to an address with datumhash TxSubmitError: Error: {\"contents\":{\"contents\":{\"contents\":{\"era\":\"ShelleyBasedEraConway\",\"error\":[\"ConwayUtxowFailure (PPViewHashesDontMatch (SJust (SafeHash \"2f50ea2546f8ce020ca45bfcf2abeb02ff18af2283466f888ae489184b3d2d39\")) (SJust (SafeHash \"244926529564c04ffdea89005076a6b6aac5e4a2f38182cd48bfbc734b3be296\")))\",\"ConwayUtxowFailure (UtxoFailure (ValueNotConservedUTxO (MaryValue (Coin 0) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"ef6ed47a6917a3cbbeb46561e8853da969343794d66128598a34af2c\"},fromList [(\"4275726e61626c65546f6b656e32\",3)])]))) (MaryValue (Coin 6194733291) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"22691d3d969ecf5802226290c2fb98e2bc08522d5b726c1f5f400105\"},fromList [(\"54657374\",21)]),(PolicyID {policyID = ScriptHash \"cac67dd80f706e084b2aac605288b2ff793475ea43b2313e1ed384ab\"},fromList [(\"4275726e61626c65546f6b656e506c75747573\",1),(\"54657374\",13),(\"accbfb633f637e3bb1abee40c9539d1effd742cd2716b3b1db9de3aaf3f37794\",1)]),(PolicyID {policyID = ScriptHash \"ef6ed47a6917a3cbbeb46561e8853da969343794d66128598a34af2c\"},fromList [(\"4275726e61626c65546f6b656e32\",4)])])))))\",\"ConwayUtxowFailure (UtxoFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash \"8e3d9138777c56c6e3fc1ce9083b13f91f5ce45da8ad7e80d4215b524af2bf8a\"}) (TxIx {unTxIx = 1})])))\"],\"kind\":\"ShelleyTxValidationError\"},\"tag\":\"TxValidationErrorInCardanoMode\"},\"tag\":\"TxCmdTxSubmitValidationError\"},\"tag\":\"TxSubmitFail\"} |
@rooooooooob btw, could you check the WASM output? It doesn't reflect the changes made in the Rust code. |
+1 for this patch, it fixed ConwayUtxowFailure PPViewHashesDontMatch for us. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's some clarification here: IntersectMBO/cardano-ledger#4554
; [ A0 | datums | A0 ]
; corresponding to a CBOR empty map and an empty map for language view.
; This empty redeeemer case has changed from the previous eras, since default
; representation for redeemers has been changed to a map. Also whenever redeemers are
; supplied either as a map or as an array they must contain at least one element,
; therefore there is no way to override this behavior by providing a custom
; representation for empty redeemers.
so it looks like which Redeemers
variant is used will not be an issue here as you can't provide one yourself that is empty
I'm not sure what you mean. For |
I run |
Yes, it's quite strange. I also tried using |
The wasm library doesn’t work as the rust library , we tried publishing as npm package but it doesn’t work |
I just set up a local WASM project with my locally built CML as a dependency and using this PR's changes I was able to get the new hash from WASM.
This was directly calling
I'm going to merge this PR. |
thanks, friend request sent. |
No description provided.